/**
 * 
 */
package com.an.springcondition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author Administrator
 *
 */
public class MagicExistCondition implements Condition {

	public static PropertySourcesPlaceholderConfigurer getPP() {
		return new PropertySourcesPlaceholderConfigurer();
	}
	@Override
	public boolean matches(ConditionContext arg0, AnnotatedTypeMetadata arg1) {
		Environment environment = arg0.getEnvironment();
		
		return environment.containsProperty("magic");
	}

}
